package cn.appsys.service.impl;

import cn.appsys.dao.AppInfoDao;
import cn.appsys.pojo.AppInfo;
import cn.appsys.pojo.Page;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import cn.appsys.service.AppInfoService;

@Service
public class AppInfoServiceImpl implements AppInfoService{

	@Autowired
	AppInfoDao appInfoDao;
	
	public Page<AppInfo> selectAppInfoByPage(AppInfo appInfo, Integer pageNo) {
		Page<AppInfo> pageInfo = new Page<AppInfo>(pageNo);
		pageInfo.setTotalCount(appInfoDao.selectAppInfoCount(appInfo));
		pageInfo.setDataList(appInfoDao.selectAppInfo(appInfo, pageInfo.getStartRow(), pageInfo.getPageSize()));
		return pageInfo;
	}

	public boolean apkexist(String APKName) {
		return appInfoDao.apkexist(APKName) > 0;
	}

	public boolean addAppInfo(AppInfo appInfo) {
		return appInfoDao.addAppInfo(appInfo) > 0;
	}

	public AppInfo getAppInfoById(Long id) {
		return appInfoDao.getAppInfoById(id);
	}
	
	public boolean updateStatus(Long id, Integer status) {
		return appInfoDao.updateStatus(id, status) > 0;
	}

	public boolean deleteAppInfo(Long id) {
		return appInfoDao.deleteAppInfo(id) > 0;
	}
}
